package datasource.source;

import datasource.bean.DateChoice;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;

/*
    模拟源头数据的产生，让每一天的数据按照不同的文件存储在linux中
 */
public class DataSourceCreate {
    public static void main(String[] args) throws Exception {

        //创建字符缓冲输入流对象
        BufferedReader br = new BufferedReader(new FileReader("/usr/local/soft/bigdata33/hefei_metro/data/hefei_metro_swipe_data.csv"));
//        BufferedWriter bw = null;

        String line = null;
        while ((line = br.readLine()) != null) {
            //2号线,2979457419,2025-02-20 12:19:54,入站,32.38,,2号线-04,四牌楼站,2025-02-20,否,0
            if(!line.contains("地铁几号线")){
                String[] info = line.split(",");
                //根据获取对应的输出流对象
                BufferedWriter bw = DateChoice.getBW(info[8]);
                if(bw!=null){
                    bw.write(line);
                    bw.newLine();
                    bw.flush();
                }
            }
        }

        System.out.println("2025-02-01 至 2025-03-01数据全部导入到linux中。。。。");

    }
}
